
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.Socket;
import java.util.logging.Level;
import java.util.logging.Logger;

/*
 * To change this template, choose Tools | Templates and open the template in
 * the editor.
 */
/**
 *
 * @author Daisuke
 */
public class Listener extends Thread {
   
    private Socket socket;

    public Listener(Socket socket){
        
        this.socket = socket;
        
    }
    
    @Override
    public void run() {
        BufferedReader reader = null;
        try {
            reader = new BufferedReader(
     new InputStreamReader(
     this.socket.getInputStream()));
            while (true) {

                System.out.println("reçu : " +reader.readLine());

            }
        } catch (IOException ex) {
            Logger.getLogger(Listener.class.getName()).log(Level.SEVERE, null, ex);
        } finally {
            try {
                reader.close();
            } catch (IOException ex) {
                Logger.getLogger(Listener.class.getName()).log(Level.SEVERE, null, ex);
            }
        }
    }
}
